package com.augurit.gzcgwsp.ywcmn.convert;

import java.util.ArrayList;
import java.util.List;

import org.dozer.DozerBeanMapper;

import com.augurit.gzcgwsp.ywcmn.entity.BaseDistrict;
import com.augurit.gzcgwsp.ywcmn.web.form.BaseDistrictForm;
/**
 * 地区配置表
 * @author Administrator
 *
 */
public class BaseDistrictConvert {
	public static BaseDistrictForm convertVoToForm(BaseDistrict entity) {
		if (entity == null) return null;
		return new DozerBeanMapper().map(entity, BaseDistrictForm.class);
	}
	
	public static void convertFormToVo(BaseDistrictForm form, BaseDistrict entity) {
		if (form == null) return;
		if (entity == null) entity = new BaseDistrict();
		
		new DozerBeanMapper().map(form, entity);
	}
	
	public static List<BaseDistrictForm> convertVoListToFormList(List<BaseDistrict> baseDistrictList) {
        List<BaseDistrictForm> BaseDistrictFormList = new ArrayList<BaseDistrictForm>();
		if(baseDistrictList != null && baseDistrictList.size() > 0) {
			for(int i=0; i<baseDistrictList.size(); i++) {
				BaseDistrictFormList.add(convertVoToForm(baseDistrictList.get(i)));
			}
		}
		return BaseDistrictFormList;
	}
	
	public static List<BaseDistrict> convertFormListToVoList(List<BaseDistrictForm> baseDistrictFormList) {
		if(baseDistrictFormList != null && baseDistrictFormList.size() > 0) {
			List<BaseDistrict> baseDistrictList = new ArrayList<BaseDistrict>();
			for(int i=0; i<baseDistrictFormList.size(); i++) {
				BaseDistrict BaseDistrict = new BaseDistrict();
				convertFormToVo(baseDistrictFormList.get(i), BaseDistrict);
				baseDistrictList.add(BaseDistrict);
			}
			return baseDistrictList;
		}
		return null;
	}
}
